package com.yc.mapper;

import com.yc.entity.Notice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

public interface NoticeMapper extends BaseMapper<Notice> {

    /**
     * 查询三条最新公告
     * @return
     */
    @Select("select id,title,content,time from t_notice ORDER BY time DESC limit 3")
    List<Map<String,Object>> queryNotice();

    /**
     * 领导查询最新的5条数据
     * @return
     */
    @Select("select id,title,content,time from t_notice ORDER BY time DESC limit 5")
    List<Map<String,Object>> queryNoticeByManage();

    /**
     * 查询最新的公告
     * @return
     */
    @Select(" select id,time,title,content FROM t_notice  where YEAR(time) = year(now())  ORDER BY time DESC limit 3 ")
    List<Notice> findNoticeYera();

}
